package com.netease.videoLoaderDemo;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.ArrayList;

public class SpriteImageInfo implements Parcelable {
    /**
     * 雪碧图宽
     */
    public int width;
    /**
     * 雪碧图高
     */
    public int height;
    /**
     * 雪碧图行数
     */
    public int rows;
    /**
     * 雪碧图列数
     */
    public int columns;
    /**
     * 雪碧图链接
     */
    public ArrayList<String> storeUrls;
    /**
     * 雪碧图间隔 单位s
     */
    public int interval;

    public SpriteImageInfo(int width, int height, int rows, int columns, int interval, ArrayList<String> storeUrls) {
        this.width = width;
        this.height = height;
        this.rows = rows;
        this.columns = columns;
        this.interval = interval;
        this.storeUrls = storeUrls;
    }

    protected SpriteImageInfo(Parcel in) {
        width = in.readInt();
        height = in.readInt();
        rows = in.readInt();
        columns = in.readInt();
        interval = in.readInt();
        storeUrls = in.createStringArrayList();
    }

    public static final Creator<SpriteImageInfo> CREATOR = new Creator<SpriteImageInfo>() {
        @Override
        public SpriteImageInfo createFromParcel(Parcel in) {
            return new SpriteImageInfo(in);
        }

        @Override
        public SpriteImageInfo[] newArray(int size) {
            return new SpriteImageInfo[size];
        }
    };

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(width);
        dest.writeInt(height);
        dest.writeInt(rows);
        dest.writeInt(columns);
        dest.writeInt(interval);
        dest.writeStringList(storeUrls);
    }
}